home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #9
/
Amiga Plus CD - 2004 - No. 09.iso
/
amigaplus
/
tools
/
dev_libs
/
feelin040718
/
arexx
/
f_update.rexx
< prev
Wrap
OS/2 REXX Batch file
|
2004-08-03
|
4KB
|
139 lines
/*
$VER: F_Update.rexx 2.00 (16.03.2003) written by Olivier LAVIALE (gofromiel@numericable.fr)
________________________________________________________________________
This tool was written in ARexx because it can be easily modified to fit
you personnal needs. But in most cases you will not change a bit of
code.
F_Update.rexx is often used by F_Create.rexx, depending the kind of
project, to check object modules and update them if necessary before
executable or library building. F_Update.rexx does not overrides
SCOPTIONS, thus you can modify SC options using local or global
settings.
For LIB projects, and if don't have modified anything, a perfect local
GST is maintained along your project, this GST should be used against
any other, so checkout your local SCOPTIONS, for your own happyness (or
clone the one in Feelin:Sources/_TEMPLATE).
Enjoy !!
*/
/*+*/Main:
SIGNAL ON FAILURE
IF ~Show('L','rexxsupport.library') THEN DO
IF ~AddLib('rexxsupport.library',0,-30) THEN DO
Say('Unable to open rexxsupport.library')
EXIT 10
END
END
PARSE ARG project dest vers revi .
dirl = ShowDir('',FILE,' ')
date = Translate(Date(E),'-','/')
time = Time()
CALL CheckHeader()
CALL CheckSources()
EXIT
/***/
/*** Procedures ************************************************************/
/*+*/CheckHeader:
up = 1
IF ~Exists('Header.h') THEN DO
RETURN
END
IF Exists(objc) THEN DO
state_file = StateF('Include:Feelin.GST')
state_objc = StateF('Header.GST')
day1 = Word(state_file,5)
day2 = Word(state_objc,5)
tik1 = Word(state_file,6) * 60 * 50 + Word(state_file,7)
tik2 = Word(state_objc,6) * 60 * 50 + Word(state_objc,7)
IF day1 = day2 THEN DO
IF tik1 < tik2 THEN up = 0
END
ELSE IF day1 < day2 THEN up = 0
END
/*
IF up THEN Say(day1 day2 ',' tik1 tik2)
RETURN
*/
src = 'Header.h'
obj = 'Header.gst'
IF up = 0 THEN up = Compare(src,obj,0)
ELSE Say('Updating
Header.GST
(New Feelin.GST)')
IF up THEN DO
ADDRESS COMMAND 'Delete >NIL:' obj '#?.o'
ADDRESS COMMAND 'SC RESETOPTS NOICON IGNORE 73 NOOBJECTNAME MGST=Header.gst Header.h'
ADDRESS COMMAND 'SetDate FILE' src 'DATE' date 'TIME' time
ADDRESS COMMAND 'SetDate FILE' obj 'DATE' date 'TIME' time
END
RETURN
/***/
/*+*/CheckSources:
list = ''
DO i = 1 TO Words(dirl)
src = Word(dirl,i)
IF Right(src,2) = '.c' THEN list = list src
ELSE IF Right(src,2) = '.a' THEN list = list src
END
DO i = 1 TO Words(list)
src = Word(list,i)
obj = Left(src,Length(src) - 1) || 'o'
IF Compare(src,obj,0) = 1 THEN DO
ADDRESS COMMAND 'Delete >NIL:' obj
IF Right(src,2) = '.c' THEN ADDRESS COMMAND 'SC NOVERSION' src
ELSE ADDRESS COMMAND 'PhxAss QUIET' src
ADDRESS COMMAND 'SetDate FILE' src 'DATE' date 'TIME' time
ADDRESS COMMAND 'SetDate FILE' obj 'DATE' date 'TIME' time
END
END
RETURN
/***/
/*+*/Compare: PROCEDURE
PARSE ARG src, obj, quiet
state_src = StateF(src)
state_obj = StateF(obj)
update = 0
IF Word(state_src,5) ~= Word(state_obj,5) THEN update = 1
IF Word(state_src,6) ~= Word(state_obj,6) THEN update = 1
IF Word(state_src,7) ~= Word(state_obj,7) THEN update = 1
IF quiet = 0 THEN DO
IF update = 1 THEN Say('
Updating
' || src || '...')
ELSE Say(src || '
ok
')
END
RETURN update
/***/
/*+*/Failure:
Say('Error compiling
' src || '
.')
EXIT 20
/***/